import util from "../../utils/util"
import api from '../../utils/Api'

const app = getApp();
Component({
  /**
   * 组件的属性列表
   */
  properties: {
    page: {
      type: String,
      value: "",
      observer(val, old) {
        this.setData({
          page: val
        });
      },
    },
    active: {
      type: String,
      value: 'home'
    },
  },

  /**
   * 组件的初始数据
   */
  data: {
    ImgNew: app.ImgNew,
    height: app.globalData.height,
    onPro: false,

    page: "",
  },


  lifetimes: {
    attached: function () {
      // 在组件实例进入页面节点树时执行
    },
    detached: function () {
      // 在组件实例被从页面节点树移除时执行
    },
  },
  detached: function () {
    // 在组件实例被从页面节点树移除时执行
  },

  /**
   * 组件的方法列表
   */
  methods: {
    undofn() {},
    onChange(e) {
      this.setData({
        active: e.detail
      })
      if (e.detail == 'home') {
        wx.reLaunch({
          url: '/pages/index/index'
        });
      } else if (e.detail == 'fuwu') {
        wx.reLaunch({
          url: '/pages/map/map'
        });
      } else if (e.detail == 'my') {
        wx.reLaunch({
          url: '/pages/my/my'
        });
      }
    },
    jumpPage(e) {
      var index = e.currentTarget.dataset.index;
      /* let c = false,role = e.currentTarget.dataset.role;
      if(role === "true"){
          c = true;
      }else{
          c = api.checkQx( role );
      } */
      if (index) {
        switch (index + "") {
          case "1":
            wx.reLaunch({
              url: '/pages/index/index'
            });
            return "";
          case "2":
            /*   wx.reLaunch({ url: '/pages/cpzx/cpzx' }); */
            return "";
          case "3":
            wx.reLaunch({
              url: '/pages/map/map'
            });
            return "";
            // case "4": wx.redirectTo({ url: '/pages/index/index' }); return "";
          case "4":
            wx.reLaunch({
              url: '/pages/my/my'
            });
            return "";
          default:
            return "";
        }
      }

    },


  }
})